import request from '@/utils/Request.js'

/**
 * 分页查询
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const selectApi = (data) => {
    return request.get('/user/selectPage', {
        params: {
            pageNum: data.pageNum,
            pageSize: data.pageSize,
            username: data.name,
            role: data.role
        }
    })
}

/**
 * 添加用户
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const addApi = (data) => {
    return request.post('/user/add', data)
}

/**
 * 编辑用户
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const updateApi = (data) => {
    return request.put('/user/update', data)
}

/**
 * 删除用户
 * @param id
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const deleteApi = (id) => {
    return request.delete('/user/delete/' + id)
}